package com.itshizhan.itjidancideveloper.models;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

@Data
@EntityListeners(AuditingEntityListener.class)
@Entity
@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
@Table(name = "article_category")
public class ArticleCategory {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	@Column(name = "category_name")
	private String categoryName;


	@Setter(AccessLevel.NONE)
	@JsonIgnore
	@OneToMany(mappedBy = "articleCategory", fetch = FetchType.EAGER)
	List<Article> articleList = new ArrayList<>();


}
